package com.usian.controller;

import com.usian.admin.SensitiveControllerApi;
import com.usian.model.admin.dtos.SensitiveDto;
import com.usian.model.admin.pojos.AdSensitive;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.service.SensitiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")//窄化路劲
public class SensitiveController implements SensitiveControllerApi {

    @Autowired
    private SensitiveService sensitiveService;


    @Override
    @PostMapping("/list")
    public ResponseResult findSensitive(@RequestBody SensitiveDto dto) {
        return sensitiveService.findSensitive(dto);
    }

    @Override
    @PostMapping("/save")
    public ResponseResult save(@RequestBody AdSensitive adSensitive) {
        return sensitiveService.merge(adSensitive);
    }

    @Override
    @PostMapping("/update")
    public ResponseResult update(@RequestBody AdSensitive adSensitive) {
        return sensitiveService.merge(adSensitive);
    }

    @Override
    @DeleteMapping("/del/{id}")
    public ResponseResult deleteById(@PathVariable("id") Integer id) {
        return sensitiveService.deleteById(id);
    }
}
